home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 628 b | 30 lines | [TEXT/ttxt] |
- --<<<
- -- Kaleida Labs, Inc.
- -- Field Guide to the ScriptX Language
- -- chapter 6, example 9
-
- -- create a module to avoid namespace conflicts
- module Scratch31 uses ScriptX end
- in module Scratch31
-
- -- defining an afterinit method
-
- global newSameKey
-
- class SameKey (SortedKeyedArray)
- instance vars key
- instance methods
- method init self #rest args #key key: -> (
- apply nextMethod self args
- self.key := key
- )
- method afterInit self #rest args #key vals: -> (
- apply nextMethod self args
- for i in vals do add self self.key i
- )
- end
-
- -- now test it out
- newSameKey := new SameKey key:@flavor \
- vals:#(@cherry,@watermelon,@peach)
- -->>>